/*
 * @Description: 学生类
 * @Author: rendc
 * @Date: 2025-08-11 14:03:17
 * @LastEditors: rendc
 * @LastEditTime: 2025-08-11 14:39:20
 */

public class Student {
  // 成员属性
  private String name;
  private int age;

  // 构造器
  public Student() {
  }

  public Student(String name, int age) {
    this.name = name;
    this.age = age;
  }

  // get\set
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((name == null) ? 0 : name.hashCode());
    result = prime * result + age;
    return result;
  }

  // ==
  // @Override
  // public boolean equals(Object obj) {
  // if (this == obj)
  // return true;
  // if (obj == null)
  // return false;
  // if (getClass() != obj.getClass())
  // return false;
  // Student other = (Student) obj;
  // if (name == null) {
  // if (other.name != null)
  // return false;
  // } else if (!name.equals(other.name))
  // return false;
  // if (age != other.age)
  // return false;
  // return true;
  // }

  @Override
  public String toString() {
    return "Student [name=" + name + ", age=" + age + "]";
  }

}